<template>
    <div class="delivery-container">
        <!-- 页面标题 -->
        <div class="page-header">
            <h1 class="page-title">校园快送</h1>
            <p class="page-subtitle">快速、便捷的校园快递配送服务</p>
        </div>

        <!-- 导航标签 -->
        <div class="nav-tabs">
            <div :class="['tab', { active: activeTab === 'user' }]" @click="switchTab('user')">
                <el-icon>
                    <User />
                </el-icon>
                <span>用户端</span>
            </div>
            <div :class="['tab', { active: activeTab === 'delivery' }]" @click="switchTab('delivery')">
                <el-icon>
                    <Box />
                </el-icon>
                <span>快送员端</span>
            </div>
            <div :class="['tab', { active: activeTab === 'admin' }]" @click="switchTab('admin')">
                <el-icon>
                    <Setting />
                </el-icon>
                <span>管理员端</span>
            </div>
        </div>

        <!-- 子组件内容区域 -->
        <div class="content-area">
            <UserClientContent v-if="activeTab === 'user'" />
            <DeliveryPersonnelContent v-if="activeTab === 'delivery'" />
            <AdminContent v-if="activeTab === 'admin'" />
        </div>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { User, Box, Setting } from '@element-plus/icons-vue'
import UserClientContent from './UserClientContent.vue'
import DeliveryPersonnelContent from './DeliveryPersonnelContent.vue'
import AdminContent from './AdminContent.vue'

// 当前激活的标签
const activeTab = ref<'user' | 'delivery' | 'admin'>('user')

// 切换标签
const switchTab = (tab: 'user' | 'delivery' | 'admin') => {
    activeTab.value = tab
}
</script>

<style scoped>
.delivery-container {
    min-height: 100vh;
    background: #f8f9fa;
}

.page-header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 20px;
}

.page-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: #0F172A;
    margin: 0 0 10px 0;
}

.page-subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin: 0;
}

.nav-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background: white;
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #7f8c8d;
    font-weight: 500;
}

.tab.active {
    background: #3498db;
    color: white;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.tab:hover:not(.active) {
    background: #ecf0f1;
    color: #2c3e50;
}

.tab .el-icon {
    margin-right: 8px;
    font-size: 1.1rem;
}

.content-area {
    min-height: calc(100vh - 200px);
}
</style>
